package com.zyt.controller;

import com.zyt.service.AnimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import com.zyt.entity.*;

@RestController
@RequestMapping("/Anime")
public class AnimeController {
    @Autowired
    private AnimeService animeService;
    @GetMapping("/")
    public List<Anime> selectAll(){
        return animeService.selectAll();
    }
    @GetMapping("/{id}")
    public Anime selectById(@PathVariable("id") Integer id){
        return animeService.selectById(id);
    }

    @DeleteMapping("/{id}")
    public void deleteById(@PathVariable("id") Integer id){
        animeService.deleteById(id);
    }
    @DeleteMapping("/")
    public void deleteMany(@RequestBody Integer[] ids){
        animeService.deleteMany(ids);
    }

    @PutMapping("/")
    public void updateById(@RequestBody Anime anime){
        animeService.updateById(anime);
    }
    @PostMapping("/")
    public void insertAnime(@RequestBody Anime anime){
        animeService.insertAnime(anime);
    }
}
